import request from '@/utils/request'
import qs from 'qs'

export function login(data) {
  return request({
    url: '/adminBase/login',
    method: 'post',
    data: qs.stringify(data),
    headers: {
      'Content-Type': 'application/x-www-form-urlencoded;charset=utf-8'
    }
  })
}

export function getInfo(token) {
  return request({
    url: '/adminBase/queryByToken',
    method: 'get'
  })
}

export function logout() {
  return request({
    url: '/vue-element-admin/user/logout',
    method: 'post'
  })
}

export function addAdminBase(data) {
  return request({
    url: '/adminBase/register',
    method: 'post',
    data
  })
}

export function getAdminBase() {
  return request({
    url: '/adminBase/queryList',
    method: 'get'
  })
}

export function updateAdminBase(data) {
  return request({
    url: '/adminBase/updateById',
    method: 'post',
    data
  })
}

export function getAdminById(data) {
  return request({
    url: '/adminBase/queryById',
    method: 'get',
    params: data
  })
}

export function getStatistic(data) {
  return request({
    url: '/adminCommission/queryStatisticsList',
    method: 'get',
    params: data
  })
}

export function getExport(data) {
  return request({
    url: '/adminCommission/export',
    method: 'get',
    params: data
  })
}
